package com.eazy.lkv2.core.spring;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

/**
 * 
 * @author jzx
 * @date  2016-08-16 上午 10:15:31
 * 
 * 和配置文件相比可以体现出他的灵活性
 */
@Configurable
public class AppConfig {

	@Value("#{db.url}")
	private String jdbcUrl;
	
	@Value("#{db.username}")
	private String userName;
	
	@Value("#{db.password}")
	private String password;
	
	@Bean
	public DataSource dataSource() {
		return new DriverManagerDataSource(jdbcUrl,userName,password);
	}
}
